<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const p = new Promise((resolve,reject)=>{
        setTimeout(function () {
            // resolve('data')//suc
            reject('fail') //fail
        },1000)
    })

    // then 方法的返回结果是promise对象 对象的状态由函数的执行结果决定
    p.then((value)=>{
        console.log(value)//suc
        return 1 ; //p对象的状态是成功(resolve)
    },(reason)=>{
        console.warn(reason)
        return 0;//p的状态 失败(reject)
    })
</script>
</body>
</html>